#pragma once

#include <string>
#include <vector>
#include "format.h"
#include "animation.h"

class CM3dLoaer
{
public:
	CM3dLoaer(){}
	~CM3dLoaer(){}

	void LoadM3d(const std::string& filename,
		std::vector<PosVertex>& vertices,
		std::vector<UINT>& indices,
		std::vector<Subset>& subsets,
		std::vector<M3dMaterial>& materials,
		SkinnedData& skinnedData);

	void ReadMaterials(std::ifstream& infile, UINT numMaterials, std::vector<M3dMaterial>& materials);
	void ReadSubsets(std::ifstream& infile, UINT numSubsets, std::vector<Subset>& subsets);
	void ReadVertices(std::ifstream& infile, UINT numVertex, std::vector<PosVertex>& vertices);
	void ReadIndices(std::ifstream& infile, UINT numTriangle, std::vector<UINT>& indices);

	void ReadOffsets(std::ifstream& infile, UINT numBones, std::vector<XMFLOAT4X4>& boneOffsets);
	void ReadHierachy(std::ifstream& infile, UINT numBones, std::vector<int>& boneHierachy);
	void ReadAnimationClips(std::ifstream& infile, UINT numBones, UINT numClips, std::map<std::string, AnimationClip>& animations);
	void ReadBoneFrames(std::ifstream& infile, UINT numKeyframes, BoneAnimation& boneAnimation);

private:

};

